<template>
	<view class="themeItem">
		<navigator :url="'/pages/classList/classList?id='+item._id+'&name='+ item.name" class="box"
			v-show="!props.isMore">
			<image :src="item.picurl"></image>
			<view class="mask">{{item.name}}</view>
			<view class="tab" v-if="getTimeAgo(item.updateTime)">{{getTimeAgo(item.updateTime)}}更新</view>
		</navigator>

		<navigator url="/pages/classify/classify" open-type="reLaunch" class="box more" v-show="props.isMore">
			<image src="../../static/image/reccomd/115130917_p2_master1200.jpg"></image>
			<view class="mask">
				<uni-icons type="more-filled" color="white" size="34"></uni-icons>
				<view>更多</view>
			</view>
		</navigator>
	</view>
</template>

<script setup>
	import { getTimeAgo } from '@/utils/common';


	const props = defineProps({
		isMore: {
			type: Boolean,
			default: false
		},
		item: {
			type: Object,
			default () {
				return {
					name: "默认名称",
					picurl: "",
					updateTime: Date.now() - 1000 * 60 * 60 * 5
				}
			}
		}
	})
console.log("@@"+props.item);
	function toClassify() {
		uni.navigateTo({
			url: "/pages/classify/classify"
		})
	}
</script>

<style lang="scss" scoped>
	.themeItem {

		// position: relative;
		.box {
			height: 340rpx;
			border-radius: 7.8rpx;
			position: relative;
			overflow: hidden;

			image {
				width: 100%;
				height: 100%;
			}

			.mask {
				width: 100%;
				height: 50rpx;
				position: absolute;
				left: 0;
				bottom: 0;
				font-size: 22rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				background: rgba(0, 0, 0, 0.2);
				color: #fff;
				backdrop-filter: blur(20rpx);
				font-weight: 600;
				font-size: 30rpx;
			}

			.tab {
				position: absolute;
				left: 0;
				top: 0;
				background: rgba(250, 129, 90, 0.7);
				backdrop-filter: blur(20rpx);
				color: #fff;
				font-size: 22rpx;
				padding: 6rpx 14rpx;
				margin: 3rpx 0 0 10rpx;
				border-radius: 0 0 25rpx 0;
				transform: scale(0.8);
				transform-origin: left top;
			}

		}

		.more {
			.mask {
				width: 100%;
				height: 100%;
				flex-direction: column;
			}
		}
	}
</style>
